package com.jrx.anytxn.investor.config;

import com.jrx.anytxn.i18n.interceptor.TenantAndLanguageInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * TODO
 *
 * @author Administrator
 * date 2020/2/18 0018
 * @version V1.0
 **/
@Configuration("webConfig")
public class WebConfiguration implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // addPathPatterns 用于添加拦截规则 /service/** 使用下面2个拦截器
        // excludePathPatterns 用户排除拦截
        //registry.addInterceptor(getServiceAuthRestInterceptor()).addPathPatterns("/service/**");
        registry.addInterceptor(getTenantAndLanguageInterceptor()).addPathPatterns("/transaction/dealManager/mistake/**");
    }

    @Bean
    TenantAndLanguageInterceptor getTenantAndLanguageInterceptor() {
        return new TenantAndLanguageInterceptor();
    }

}
